<template>
	<view class="">
		<view class="sraech-box">
			<u-search placeholder="请输入项目名称" shape="square" v-model="searchData.name" @search="onSearch" :showAction="false" />
		</view>
		<view class="">
			<view class="my-list mt-20">
				<u-list :height="swiperHeight" @scrolltolower="scrolltolower" v-if="dataList.length > 0">
					<u-list-item v-for="(proIm, proIx) in dataList" :key="proIm.id">
						<view class="item fsize-26 flex align-center">
							<image class="img shrink0" :src="proIm.image"></image>
							<view class="w-100 ml-20 flex justify-between align-center">
								<view class="">
									<view class="fsize-32 fweigh-600">{{proIm.name}}</view>
									<view class="text-gray">预约量{{proIm.subscribeCount}}</view>
									<view class="text-red"><text class="fsize-24">￥</text>{{proIm.price}}</view>
								</view>
								
								<view class="">
									<view class="">
										<u-icon name="share" size="20" color="#1890ff" label="分享" labelSize="24rpx"
											@click=""></u-icon>
									</view>
								</view>
							</view>
						</view>
					</u-list-item>
					<u-loadmore :status="loadmore.status" :icon-type="loadmore.iconType"
						:load-text="loadmore.loadText.loadText" margin-top="0" margin-bottom="20"
						class="coreshop-padding-top-10" />
				</u-list>
			</view>
			<!-- 无数据时默认显示 -->
			<view class="emptybox" v-if="dataList.length == 0">
				<u-empty icon-size="150" text="暂无数据" mode="data"></u-empty>
			</view>
		</view>
		
		
	</view>
</template>

<script>
	import listHeightMixin from '@/common/computedAltitude.js'
	export default {
		mixins:[listHeightMixin],
		data() {
			return {
				loadmore: {
					status: 'loadmore',
					iconType: 'flower',
					loadText: {
						loadmore: '轻轻上拉',
						loading: '努力加载中',
						nomore: '实在没有了'
					},
				},
				curNow: 0,
				dataList: [],
				searchData: {
					name: '',
					page: 1,
					limit: 10
				},
				actionSheet: {
					show: false,
					title: '',
					list: []
				}
			}
		},
		mounted() {
			let that = this

		},
		onLoad() {
			this.getPageList()
		},
		methods: {
			// 搜索事件
			onSearch() {
				this.searchData.page = 1
				this.getPageList()
			},
			getPageList() {
				this.$reqPost('CoreCmsProjectList', this.searchData).then(res => {
					this.dataList = [...this.dataList, ...res.data]
					if (res.count > this.dataList.length) {
						this.loadmore.status = 'loadmore';
						this.searchData.page++;
					} else {
						// 数据已加载完毕
						this.loadmore.status = 'nomore';
					}
				})
			},
			scrolltolower() {
				if (this.loadmore.status === 'loadmore') {
					this.getPageList();
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.img {
		width: 140rpx;
		height: 140rpx;
		border-radius: 10rpx;
	}
</style>